let bodyScale = 1;
let colors = [
    '#bf456a',
    '#2caafc',
    '#d29834',
    '#ff8297',
    '#c79cfb',
    '#5cdbd3',
    '#ff85c0',
    // '#ffd591',
    // '#eaff8f',
    // '#d3adf7',
    // '#91d5ff',
    // '#ffa39e',
    // '#87e8de',
    // '#ffadd2',
    // '#adc6ff',
    // '#fffb8f',
    // '#b7eb8f',
    // '#ffbb96',
    // '#d9f7be',
    // '#ffd6e7'
];
let [cTextWeek, cSplitLine] = ["#0083b3", "#0083b3"];
let barWidth = 12 * bodyScale;
let lineStyle = {
    shadowColor: 'rgba(255, 255, 255, 1)',
    shadowBlur: 4 * bodyScale
};
let pieLabelOut = {
    color: '#fff',
    normal: {
        position: 'outer'
    }
};

//所有图表的公共属性
let opt_com = {
    color: colors,
    textStyle: {
        fontFamily: 'PingFang SC, microsoft yahei,微软雅黑, sans-serif',
        color: cTextWeek,
        fontSize: 10 * bodyScale
        // width:'120%'
    },
    legend: {
        itemWidth: 7 * bodyScale,
        itemHeight: 7 * bodyScale,
        textStyle: {
            fontSize: 10 * bodyScale,
            color: cTextWeek, //图例白色,全局样式不能影响到
        },
        top: '2%'
    },
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            //type: 'cross',
            label: {
                backgroundColor: '#6a7985'
            }
        },
        textStyle:{
            align:'left'
        }

    },
    grid: {
        bottom: "15%",//底边留空
        top: '29%',
        left: '8%',
        right: '5%',
    }
};

//直角坐标系坐标轴
let axis_com = {
    axisLabel: { //标签名称
        fontSize: 12 * bodyScale
    },
    nameTextStyle: { //坐标轴名称
        fontSize: 12 * bodyScale
    },
    nameGap: 10 * bodyScale, //坐标轴名称距离
    axisTick: { //小刻度线
        show: false
    },
    axisLine: { //坐标轴
        lineStyle: {
            color: cTextWeek
        }
    },
    splitLine: { //分割线
        show: false,
        lineStyle: {
            color: cTextWeek
        }
    },
    boundaryGap: false
};
//圆环图 series里的属性设置
let circle_series_label = {
    normal: {
        show: true,
        fontSize: 12 * bodyScale
    },
    emphasis: {
        show: true,
        textStyle: {
            fontSize: 15 * bodyScale,
            fontWeight: 'normal'
        }
    }
};
let circle_series_labline = {
    normal: {
        show: true,
    }

};
let axisLine_Y = {
    lineStyle: {
        color: '#0083b3'
    }
};
let splitLine = {
    show: false
};
//条形图(水平)公共属性
//opt_bar_horizon写在里面是为了不让后面的对象覆盖opt_com
let opt_bar_horizon = $.extend(true, {}, opt_com, {
    xAxis: $.extend(true, {}, axis_com, {
        type: 'value'
    }),
    yAxis: $.extend(true, {}, axis_com, {
        boundaryGap: true,
        type: 'category'
    }),
    barWidth: '40%'
});

//条形图(竖直)公共属性
let opt_bar_vertical = $.extend(true, {}, opt_com, {
    xAxis: $.extend(true, {}, axis_com, {
        boundaryGap: true,
        type: 'category'
    }),
    yAxis: $.extend(true, {}, axis_com, {
        type: 'value'
    }),
    //这里写此类图表其他属性
});

//折线图公共属性
let opt_line = $.extend(true, {}, opt_com, {
    xAxis: $.extend(true, {}, axis_com, {
        type: 'category',
    }),
    yAxis: $.extend(true, {}, axis_com, {
        type: 'value',
        // nameLocation:'start',
        nameGap: 10 * bodyScale,
        nameTextStyle: {
            padding: [0, 12 * bodyScale, 0, 0],
            // backgroundColor:'#f60'
        }
    }
        //这里写此类图表其他属性
    ),
});

//饼图公共属性
let opt_pie = $.extend(true, opt_com,
    {
        legend: {
            orient: 'vertical',
            right: '3%',
            top: 'middle'
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                //type: 'cross',
                label: {
                    backgroundColor: '#6a7985'
                }
            },
            textStyle:{
                align:'left'
            },
            formatter: "{b} : {c}"
        },

        // labelLine: {
        //     lineStyle: { color: '#fff' }
        // },

        animationType: 'scale',
        animationEasing: 'elasticOut',
        animationDelay: function (idx) {
            return Math.random() * 200;
        }

    });

//散点图公共属性
let opt_scatter = $.extend(true, {}, opt_com, {
    xAxis: $.extend(true, {}, axis_com, {
        type: 'category'
    }),
    yAxis: $.extend(true, {}, axis_com, {
        type: 'category'
    }),

    //这里写此类图表其他属性

});

//雷达图公共属性
let opt_radar = $.extend(true, {}, {
    legend: {
        itemWidth: 7 * bodyScale,
        itemHeight: 7 * bodyScale,
        textStyle: {
            fontSize: 10 * bodyScale,
            color: cTextWeek, //图例白色,全局样式不能影响到
        },
        top: '2%',
        left:'right',
        orient:'vertical'
    },
    tooltip: {
        axisPointer: {
            label: {
                backgroundColor: '#6a7985'
            }
        },
        textStyle:{
            align:'left',
            fontFamily: 'PingFang SC, microsoft yahei,微软雅黑, sans-serif',
           // fontSize: 15 * bodyScale
        }
    },
    radar: {
        center: ['50%', '58%'],
        // shape: 'circle',
        name: {
            textStyle: {
                color: '#0cf',
                fontSize: 12 * bodyScale
                // backgroundColor: '#999',
                // borderRadius: 3,
                // padding: [3, 5]
            }
        },

        splitArea: {
            areaStyle: {
                color: 'rgba(0,0,0,0)'
            }
        },
        axisLine: {
            lineStyle: {
                color: '#0cf'
            }
        },
        splitLine: {
            lineStyle: {
                color: '#0cf'
            }
        }
    },
});
//圆环图
let opt_circle = $.extend(true, {}, opt_com, {
    tooltip: {
       // formatter: "{a} <br/>{b}: {c} ({d}%)"
        trigger: 'axis',
        axisPointer: {
            //type: 'cross',
            label: {
                backgroundColor: '#6a7985'
            }
        },
        textStyle:{
            align:'left'
        },
    },
    color: colors,
    legend: {
        center: 'center',
        textStyle: {
            color: '#0cf',
            fontSize: 10 * bodyScale
        },
        top: '2%'
    }

});

//倒三角
let opt_funnel = $.extend(true, {}, opt_com, {
    tooltip: {
        trigger: 'axis',
        axisPointer: {
           // type: 'cross',
            label: {
                backgroundColor: '#6a7985'
            }
        },
        textStyle:{
            align:'left'
        },
        formatter: "{a} <br/>{b} : {c}%"
    },
    calculable: true,
    legend: {
        show: false
    },
})




function scatterSymbolSize(data) {
    return Math.sqrt(data[2]) * bodyScale / 2;
}

function lineAreaStyle(index) {
    return {
        color: {
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [{
                offset: 0, color: colors[index] // 0% 处的颜色
            }, {
                offset: 1, color: '#00adef11' // 100% 处的颜色
            }]
        }
    }

}
